import { ShaderChunk } from "three";
import ShaderLib from "../ShaderLib";

export default class BlinkingRingShader {
    public static getVertexShader() {
        return ShaderLib.getDefaultVertexShader();
    }

    public static getFragmentShader() {
        let shader = `
            #include <common>
		    #include <fog_pars_fragment>
		    #include <logdepthbuf_pars_fragment>
            varying vec2 uvTexcoord;
            uniform float innerRadius;
            uniform float radius;            
            uniform float time;
            uniform vec3 v_color;
      
            void main(){     
                #include <logdepthbuf_fragment>  
                vec2 uv = uvTexcoord;
                float r = length(uv);
                float innerOuterRatio;
                innerOuterRatio = innerRadius/radius;
                if (pow(uv.x-0.5,2.)+pow(uv.y-0.5,2.) < (innerOuterRatio*innerOuterRatio/4.0)) {
                    discard;
                }
                gl_FragColor = vec4(v_color.rgb, 1.*time);
                #include <fog_fragment>
            }
        `;
        return shader;
    }

}
